-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Fix hidden glob reexports 146164 #146212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sitetester
wants to merge
4
commits into
rust-lang:master
from
sitetester:fix-hidden-glob-reexports-146164
Open
Fix hidden glob reexports 146164 #146212
sitetester
wants to merge
4
commits into
rust-lang:master
from
sitetester:fix-hidden-glob-reexports-146164
+11
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes rust-lang#146164 The lint was incorrectly warning when importing the same item that's already available through a glob re-export. This adds a check to only warn when the explicit import and glob import resolve to different items.
...ny warnings or errors
@rustbot
rustbot
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Sep 4, 2025
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@sitetester
sitetester
force-pushed
the
fix-hidden-glob-reexports-146164
branch
from
September 6, 2025 10:28
967782f
to
397204d
Compare
@rustbot
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Sep 6, 2025
- There are issue links (such as
#123
) in the commit messages of the following commits.
Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.
The lint was incorrectly warning when importing the same item that's already available through a glob re-export. This adds a check to only warn when the explicit import and glob import resolve to different items.
@sitetester
sitetester
force-pushed
the
fix-hidden-glob-reexports-146164
branch
from
September 6, 2025 12:07
397204d
to
e9af075
Compare
@petrochenkov PR is open for review.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
Fixes: #146164
The hidden_glob_reexports lint will now skip generating a warning when the imported type points to the same type as public glob reexport
Let's create the following files to check the current behaviour
Current behaviour
Can test using
~/rust/build/host/stage1/bin/rustc --edition 2021 fix/before/allow_when_same.rs
~/rust/build/host/stage1/bin/rustc --edition 2021 fix/before/warn_when_same.rs
Fix
compiler/rustc_resolve/src/imports.rs
./x build --stage 1 # Compiler + standard library + sysroot (complete setup)
Create these files
~/rust/build/host/stage1/bin/rustc --edition 2021 fix/after/not_warn_when_same.rs
~/rust/build/host/stage1/bin/rustc --edition 2021 fix/after/should_warn_when_private_shadows_glob.rs
For development/quick testing,
hidden-glob-reexports-issue-146164.rs is the official test that goes into Rust, as every bug fix needs a test as per Rust standards. It's part of Rust's test suite that runs automatically
For official/CI testing